<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/4/24
 * Time: 18:09
 */
//create a thread
$thread_id = wing_create_thread(function(){
    $i=0;
    // while(true) {
    echo 123;
    file_put_contents("D:/123.html", "hello".$i,FILE_APPEND);
    $i++;
    sleep(1);
    // }
});

var_dump($thread_id);




//wait for the process exit
wing_thread_wait($thread_id,-1);


/*$exit_code1 = 0;
$exit_code2 = 0;
while(wing_thread_isalive($thread_id,$exit_code1)||wing_thread_isalive($thread_id2,$exit_code2)){
    var_dump($thread_id,$exit_code1);
    var_dump($exit_code2,$exit_code2);
    echo "\n";
    sleep(1);
}
var_dump($thread_id,$exit_code1);
var_dump($exit_code2,$exit_code2);*/

echo "thread exit\n";